# -*- coding: utf-8 -*-
from db.mysql import MysqlClient
from common.helper import Helper
from itertools import product

name = "小宝保"
mysql = MysqlClient()
plan = {
    "planA": {
        "year": ["0-18"],
        "days": ["1y"],
        "people_count": ["1"],
        "accident_death": ["200000"],
        "accident_medical": ["30000"],
        "price": ["68.00"]
    },
    "planB": {
        "year": ["0-18"],
        "days": ["1y"],
        "people_count": ["1"],
        "accident_death": ["300000"],
        "accident_medical": ["30000"],
        "price": ["80.00"]
    },
    "planC": {
        "year": ["0-18"],
        "days": ["1y"],
        "people_count": ["1"],
        "accident_death": ["300000"],
        "accident_medical": ["30000"],
        "price": ["128.00"]

    }

}
for k in plan:
    for v in product( plan[k]["year"],plan[k]["days"],plan[k]["people_count"],plan[k]["accident_death"],plan[k]["accident_medical"],plan[k]["price"]):
        data = Helper.formatProductInfo( plan[k],v )
        data["name"] = name
        data["company"] = "锦泰保险"
        Helper.mergeTable(name,mysql,data)

